package co.yixiang.yshop.module.crm.dal.mysql.crmworkwxcustomer;

import java.util.*;

import co.yixiang.yshop.framework.common.pojo.PageResult;
import co.yixiang.yshop.framework.mybatis.core.query.LambdaQueryWrapperX;
import co.yixiang.yshop.framework.mybatis.core.mapper.BaseMapperX;
import co.yixiang.yshop.module.crm.dal.dataobject.crmworkwxcustomer.CrmWorkWxCustomerDO;
import org.apache.ibatis.annotations.Mapper;
import co.yixiang.yshop.module.crm.controller.admin.crmworkwxcustomer.vo.*;

/**
 * 企业微信客户 Mapper
 *
 * @author yshop
 */
@Mapper
public interface CrmWorkWxCustomerMapper extends BaseMapperX<CrmWorkWxCustomerDO> {

    default PageResult<CrmWorkWxCustomerDO> selectPage(CrmWorkWxCustomerPageReqVO reqVO) {
        return selectPage(reqVO, new LambdaQueryWrapperX<CrmWorkWxCustomerDO>()
                .eqIfPresent(CrmWorkWxCustomerDO::getCorpId, reqVO.getCorpId())
                .eqIfPresent(CrmWorkWxCustomerDO::getExternalUserid, reqVO.getExternalUserid())
                .likeIfPresent(CrmWorkWxCustomerDO::getName, reqVO.getName())
                .eqIfPresent(CrmWorkWxCustomerDO::getAvatar, reqVO.getAvatar())
                .eqIfPresent(CrmWorkWxCustomerDO::getUnionid, reqVO.getUnionid())
                .eqIfPresent(CrmWorkWxCustomerDO::getFollowUser, reqVO.getFollowUser())
                .likeIfPresent(CrmWorkWxCustomerDO::getCorpFullName, reqVO.getCorpFullName())
                .likeIfPresent(CrmWorkWxCustomerDO::getCorpName, reqVO.getCorpName())
                .eqIfPresent(CrmWorkWxCustomerDO::getType, reqVO.getType())
                .eqIfPresent(CrmWorkWxCustomerDO::getGender, reqVO.getGender())
                .eqIfPresent(CrmWorkWxCustomerDO::getStatus, reqVO.getStatus())
                .eqIfPresent(CrmWorkWxCustomerDO::getWeigh, reqVO.getWeigh())
                .eqIfPresent(CrmWorkWxCustomerDO::getCustomerId, reqVO.getCustomerId())
                .betweenIfPresent(CrmWorkWxCustomerDO::getCreateTime, reqVO.getCreateTime())
                .orderByDesc(CrmWorkWxCustomerDO::getId));
    }

}